package com.xgg.taiwuinfo.gongfa.abilities;

import android.content.Context;

import com.xgg.taiwuinfo.utils.Defend;

public class Ability_Huti_Counter {
    //可能是反击，也可能是反震
    int Type;
    public final static int TYPE_COUNTER = 1;
    public final static int TYPE_KNOCK = 2;
    //反击/反震范围
    double RangeLow;
    double RangeHigh;

    //反击条件
    int CounterContidion;
    public final static int CC_NEISHANG = 0x01;
    public final static int CC_WAISHANG = 0x02;

    //反击比例
    int CounterRate;
    //反震比例
    int NeiShangRate;
    int WaiShangRate;

    public Ability_Huti_Counter(int type , double low , double high, int condition , int rate , int neishangrate , int waishangrate)
    {
        Type = type;
        RangeHigh = high;
        RangeLow = low;
        CounterContidion = condition;
        CounterRate = rate;
        NeiShangRate = neishangrate;
        WaiShangRate = waishangrate;
    }

    public String getCounterString(Context ctx)
    {
        String rt ;
        if (Type == TYPE_COUNTER)
        {
            rt = String.format("反击范围: %.02f - %.02f\r\n" , RangeLow , RangeHigh);
            String tmpcondition = Defend.getString(ctx, CounterContidion);
            String tmp = String.format("将敌人的普通攻击[%s]时，以%d%%的威力反击敌人\r\n" , tmpcondition , CounterRate);
            rt += tmp;
        }
        else
        {
            rt = String.format("反震范围: %.01f - %.01f\r\n" , RangeLow , RangeHigh);
            if (WaiShangRate > 0) {
                String tmp = String.format("反震所受外伤的%d%%给敌人\r\n", WaiShangRate);
                rt += tmp;
            }
            if (NeiShangRate > 0)
            {
                String tmp = String.format("反震所受内伤的%d%%给敌人\n", NeiShangRate);
                rt += tmp;
            }
        }
        return rt;
    }

}
